package com.huhai.controller;



import com.huhai.pojo.Item;
import com.huhai.services.ItemServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping(value = "/item")
public class ItemController {
    @Autowired
    private ItemServices itemServices;

    @RequestMapping(value = "/showItem/{id}",produces ="text/html;charset=UTF-8")
    public String findById(@PathVariable("id") int id, Model model) {

        Item item = itemServices.findById(id);
        System.out.println(item.toString());
        model.addAttribute("item",item);
        return "item";
    }

}
